package com.linkoog.devtools.intellij.action;

import com.intellij.openapi.actionSystem.ActionManager;
import com.intellij.openapi.actionSystem.AnAction;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.actionSystem.DefaultActionGroup;
import com.intellij.openapi.actionSystem.Presentation;
import com.intellij.openapi.project.DumbAware;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

public class SplitButtonGroup extends DefaultActionGroup implements DumbAware {

    @Override
    public AnAction @NotNull [] getChildren(@Nullable AnActionEvent e) {
        Presentation presentation = e.getPresentation();
        AnAction[] actions =  super.getChildren(e);
        DefaultActionGroup actionGroup = new DefaultActionGroup(actions);
        SplitButtonAction splitButtonAction = new SplitButtonAction(actionGroup, presentation.getIcon());
        return new AnAction[]{splitButtonAction};
    }
}
